Skip to content

gh-136267: Read the target version from patchlevel.h in build-details.json - #161532

Merged
itamaro merged 1 commit into
python:mainfrom
itamaro:gh-136267-target-version
Nov 20, 2026
Merged

itamaro merged 1 commit into
python:mainfrom
itamaro:gh-136267-target-version

Conversation

@itamaro

@itamaro itamaro commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

With --with-build-python, the build Python can differ from the target in patch version or release serial, but language.version_info, implementation.version and implementation.hexversion came from the running interpreter. This reads them from Include/patchlevel.h, the same way the Doc build does, with a fallback to sys.version_info when the header is not there.

Written with assistance from Claude Fable 5.1

…etails.json

With --with-build-python, the build Python can differ from the target in
patch version or release serial, but version_info and hexversion came from
the running interpreter. Read them from Include/patchlevel.h instead,
falling back to sys.version_info when the header is not there.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@itamaro
itamaro requested a review from brettcannon November 7, 2026 06:09
@itamaro itamaro added build The build process and cross-build needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 7, 2026
@itamaro
itamaro marked this pull request as ready for review November 7, 2026 15:58
@itamaro
itamaro requested a review from FFY00 as a code owner November 7, 2026 15:58
@itamaro
itamaro merged commit b09a7e9 into python:main Nov 20, 2026
74 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @itamaro for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 20, 2026

Copy link
Copy Markdown

GH-162301 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 20, 2026
@bedevere-app

bedevere-app Bot commented Nov 20, 2026

Copy link
Copy Markdown

GH-162302 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 20, 2026
itamaro added a commit that referenced this pull request Nov 20, 2026
…details.json (GH-161532) (#162301)

gh-136267: Read the target version from patchlevel.h in build-details.json (GH-161532)

With --with-build-python, the build Python can differ from the target in
patch version or release serial, but version_info and hexversion came from
the running interpreter. Read them from Include/patchlevel.h instead,
falling back to sys.version_info when the header is not there.
(cherry picked from commit b09a7e9)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
itamaro added a commit that referenced this pull request Nov 20, 2026
…details.json (GH-161532) (#162302)

gh-136267: Read the target version from patchlevel.h in build-details.json (GH-161532)

With --with-build-python, the build Python can differ from the target in
patch version or release serial, but version_info and hexversion came from
the running interpreter. Read them from Include/patchlevel.h instead,
falling back to sys.version_info when the header is not there.
(cherry picked from commit b09a7e9)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build The build process and cross-build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants